<template>
    <div class="user-management">
        <!-- 搜索区域 -->
        <el-card class="search-box">
            <el-form :model="searchForm" inline>
                <el-form-item label="用户名">
                    <el-input v-model="searchForm.username" placeholder="请输入用户名" clearable />
                </el-form-item>
                <el-form-item label="手机号">
                    <el-input v-model="searchForm.phone" placeholder="请输入手机号" clearable />
                </el-form-item>
                <el-form-item label="是否启用">
                    <el-select v-model="searchForm.enabledStatus" style="width: 120px;">
                        <el-option label="全部" value="" />
                        <el-option label="启用" :value="1" />
                        <el-option label="禁用" :value="0" />
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="handleSearch">搜索</el-button>
                </el-form-item>
            </el-form>
        </el-card>

        <!-- 用户表格 -->
        <el-card class="mt-20">
            <el-table :data="userList" v-loading="loading" style="width: 100%" :fit="true">
                <el-table-column prop="username" label="姓名" min-width="120" />
                <el-table-column prop="phone" label="手机号" min-width="180" />
                <el-table-column prop="gender" label="性别" min-width="100">
                </el-table-column>
                <el-table-column prop="enabled" label="状态" min-width="120">
                </el-table-column>
                <el-table-column label="操作" min-width="200" fixed="right">
                </el-table-column>
            </el-table>
        </el-card>
    </div>
</template>

<script setup lang="ts">
import { reactive } from 'vue'

// 搜索表单
const searchForm = reactive({
    username: '',
    phone: '',
    enabledStatus: '' as '' | 0 | 1
})


</script>

<style scoped>
.search-box {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}
</style>